package com.hua.api.modules.finance.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;


@Entity
@Data
@Table(name="user_account_history")
public class UserAccountHistory implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`user_id`")
    @ApiModelProperty(value = "充值用户")
    private Integer userId;

    @Column(name = "`before_amount`")
    @ApiModelProperty(value = "操作前金额")
    private Double beforeAmount;

    @Column(name = "`amount`")
    @ApiModelProperty(value = "金额")
    private Double amount;

    @Column(name = "`after_amount`")
    @ApiModelProperty(value = "变动之后金额")
    private Double afterAmount;

    @Column(name = "`created_time`")
    @ApiModelProperty(value = "创建时间")
    private Date createdTime;

    @Column(name = "`type`")
    @ApiModelProperty(value = "流水类型")
    private String type;

    @Column(name = "`remarks`")
    @ApiModelProperty(value = "备注")
    private String remarks;

    @Column(name = "`state`")
    @ApiModelProperty(value = "状态")
    private Integer state;

    public void copy(UserAccountHistory source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
